package first.group.ssh.packet;

import first.group.ssh.SSHConsts;
import first.group.ssh.packet.reader.StringReader;
import java.nio.ByteBuffer;

public class UserAuthBanner extends Packet{
    public final String message;
    public final String language;

    public UserAuthBanner(String message, String language) {
        super(SSHConsts.SSH_MSG_USERAUTH_BANNER);
        this.message = message;
        this.language = language;
    }

    public static PacketParser<UserAuthBanner> PARSER = new UserAuthBanner.Parser();

    private static class Parser extends PacketParser<UserAuthBanner> {

        @Override
        public UserAuthBanner parse(ByteBuffer buffer) {
            var message = StringReader.readString(buffer);
            if (message == null) {
                return null;
            }
            var language = StringReader.readString(buffer);
            if (language == null) {
                return null;
            }
            return new UserAuthBanner(message, language);
        }
    }

    @Override
    public void write(ByteBuffer buffer) {
        throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
    }
}
